Switch case statements are a
substitute for long if statements. The basic format for using switch case is
outlined above.
The expression or variable has a value. The case says that if it has the
value of whatever is after that cases then do whatever follows the colon. The
break is used to break out of the case statements. Break is a keyword that
breaks out of the code block, usually surrounded by braces, which it is in.
In this case, break prevents the program from testing the next case statement
also.
Switch case serves as a simple way to write long if statements. Often it can
be used to process input from a user.